package day05;

import java.util.Scanner;

public class Addition {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int score = 0;
        for(int i=1;i<=10;i++){
            int a=(int)(Math.random()*100+1);
            int b=(int)(Math.random()*100+1);
            int result=a+b;
            System.out.println("("+i+")"+a+"+"+b+"=?");
            System.out.println("算吧！");
            int answer=scan.nextInt();
            if(result==answer){
                System.out.println("答对了");
                score+=10;
            }else {
                System.out.println("答错了");
            }
        }
        System.out.println("score:"+score);

//        Scanner scan=new Scanner(System.in);
//        int score=0;//总分
//        for(int i=1;i<=10;i++){//10次
//            //1)出题  2)答题  3)判题
//            int a=(int)(Math.random()*100+1);
//            int b=(int)(Math.random()*100+1);
//            System.out.println(a+"+"+b+"=?");//出题
//            int c=scan.nextInt();
//            if(a+b==c){
//                score+=10;
//            }
//        }
//        System.out.println("score:"+score);
    }
}
